$().ready(function() {
    $('.delete').click(function() {
        return confirm('Are you sure?');
    });

    $("#tree").jstree({ "plugins" : ["themes","html_data", "ui", "dnd"],
        "dnd": {
            'drop_finish' : function() {
                console.log('drop finished');
            },

            'drag_check' : function(data) {
                return true;
            },

            'drag_finish' : function(data) {
                console.log('Drag finished');
            }
        }
    })
            .bind("select_node.jstree", function (event, data) {
                var id = data.rslt.obj.attr("id");
                location.href = '/pages/edit/id/' + id;
            })
            .delegate("a", "click", function (event, data) {
                event.preventDefault();
            });
});

